<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>6.点语法操作DOM节点元素</title>
  <style>
    .hide{
      display: none;
    }
  </style>
</head>
<body>
  <div>houdunren.com</div>
  <div>hdcms.com</div>        
  <script>
    const div = document.querySelectorAll(`div`);
  /*  console.log(div); //NodeList(2)[div, div]
    [1,3].map(item => console.log(item));
    // 1
    //3
    //Dom 数组没有 map方法 ,可以使用原型链的map方法
    Array.prototype.map.call(div,function(item){
      console.log(item);
    });*/
    // Dom转成数组之后
    [...div].map(function(item){
      item.addEventListener('click',function(){
        this.classList.toggle('hide');
      })
    });
  </script>
</body>
</html>